{ Statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=99
  Verdict: Accepted
}
uses
	SysUtils, Math;
 
var
	s, x : string;
 
procedure kmp(s,x:string); {X - substr}
var p:array[1..50010] of longint; n,m,i,q:longint;
 
procedure prefix;
var m,k,q:longint;
begin
fillchar(p,sizeof(p),0);
m:=length(x);
p[1]:=0;
k:=0;
for q:=2 to m do begin
  while (k>0) and (x[k+1]<>x[q]) do k:=p[k];
  if x[k+1]=x[q] then inc(k);
  p[q]:=k;
end;
end;
 
begin
n:=length(s);
m:=length(x);
prefix;
q:=0;
for i:=1 to n do begin
  while (q>0) and (x[q+1]<>s[i]) do q:=p[q];
  if x[q+1]=s[i] then inc(q);
  if q=m then begin
		writeln(i - m);
		q:=p[q];
  end;
end;
end;
 
begin
	reset(input,'input.txt');
	rewrite(output,'output.txt');
	readln(s);
	readln(x);
	kmp(s, x);
end.